<?php

/**
 * Traitement filter form base class.
 *
 * @package    appcemhti
 * @subpackage filter
 * @author     Steve Cancès
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseTraitementFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_type_traitement'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TypeTraitement'), 'add_empty' => true)),
      'id_lot'                => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Lot'), 'add_empty' => true)),
      'id_echantillon'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Echantillon'), 'add_empty' => true)),
      'id_lieu'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Lieu'), 'add_empty' => true)),
      'id_mesure'             => new sfWidgetFormFilterInput(),
      'ok'                    => new sfWidgetFormFilterInput(),
      'numero_fiche_machine'  => new sfWidgetFormFilterInput(),
      'date_debut_traitement' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'duree_traitement'      => new sfWidgetFormFilterInput(),
      'repertoire'            => new sfWidgetFormFilterInput(),
      'ordre'                 => new sfWidgetFormFilterInput(),
      'created_at'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'updated_at'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
    ));

    $this->setValidators(array(
      'id_type_traitement'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('TypeTraitement'), 'column' => 'id_type_traitement')),
      'id_lot'                => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Lot'), 'column' => 'id_lot')),
      'id_echantillon'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Echantillon'), 'column' => 'id_echantillon')),
      'id_lieu'               => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Lieu'), 'column' => 'id_lieu')),
      'id_mesure'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'ok'                    => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'numero_fiche_machine'  => new sfValidatorPass(array('required' => false)),
      'date_debut_traitement' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'duree_traitement'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'repertoire'            => new sfValidatorPass(array('required' => false)),
      'ordre'                 => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'created_at'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('traitement_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Traitement';
  }

  public function getFields()
  {
    return array(
      'id_traitement'         => 'Number',
      'id_type_traitement'    => 'ForeignKey',
      'id_lot'                => 'ForeignKey',
      'id_echantillon'        => 'ForeignKey',
      'id_lieu'               => 'ForeignKey',
      'id_mesure'             => 'Number',
      'ok'                    => 'Number',
      'numero_fiche_machine'  => 'Text',
      'date_debut_traitement' => 'Date',
      'duree_traitement'      => 'Number',
      'repertoire'            => 'Text',
      'ordre'                 => 'Number',
      'created_at'            => 'Date',
      'updated_at'            => 'Date',
    );
  }
}
